% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logit_correction_polyint_res.r
\name{logit_correction_polyint_res}
\alias{logit_correction_polyint_res}
\title{Full information model with Dahl's correction function}
\usage{
logit_correction_polyint_res(starts3, dat, otherdat, alts)
}
\arguments{
\item{starts3}{Starting values as a vector (num). For this likelihood,
the order takes: c([marginal utility from catch], [catch-function
parameters], [polynomial starting parameters], [travel-distance
parameters], [catch sigma]). \cr \cr
The number of polynomial interaction terms is currently set to 2, so
given the chosen degree 'polyn' there should be
(((polyn+1)*2) + 2)*(k) polynomial starting parameters, where (k)
equals the number of alternatives. The marginal utility from catch
and catch sigma are of length equal to unity respectively. The 
catch-function and travel-distance parameters are of length (# of
catch variables)*(k) and (# of cost variables) respectively.}

\item{dat}{Data matrix, see output from shift_sort_x, alternatives with
distance.}

\item{otherdat}{Other data used in model (as a list containing objects
`griddat`, `intdat`, `startloc`, `polyn`, and `distance`). \cr \cr
For catch-function variables (`griddat`) alternative-invariant
variables that are interacted with zonal constants to form the catch
portion of the likelihood. Each variable name therefore corresponds
to data with dimensions (number of observations) by (unity), and
returns (k) parameters where (k) equals the number of alternatives.
For travel-distance variables alternative-invariant
variables that are interacted with travel distance to form the cost
portion of the likelihood. Each variable name therefore corresponds
to data with dimensions (number of observations) by (unity), and
returns a single parameter. Any number of catch-function and
travel-distance variables are allowed, as a list of matrices. Note
the variables (each as a matrix) within `griddat` and `intdat` have
no naming restrictions. \cr \cr
Catch-function variables may correspond to variables that affect
catches across locations, or travel-distance variables may be vessel
characteristics that affect how much disutility is suffered by
traveling a greater distance. Note in this likelihood the
catch-function variables vary across observations but not for each
location: they are allowed to affect catches across locations due to
the location-specific coefficients. If there are no other data, the
user can set catch-function variables as ones with dimension
(number of observations) by (number of alternatives) and
travel-distance variables as ones with dimension (number of
observations) by (unity). \cr \cr
The variable startloc is a matrix of dimension
(number of observations) by (unity), that corresponds to the starting
location when the agent decides between alternatives. \cr \cr
The variable polyn is a vector of length equal to unity corresponding
to the chosen polynomial degree. \cr \cr
The variable distance is a matrix of dimension
(number of observations) by (number of alternatives) corresponding
to the distance to each alternative.}

\item{alts}{Number of alternative choices in model as length equal to
unity (as a numeric vector).}
}
\value{
ld: negative log likelihood
}
\description{
This returns the different components of the likelihood (for results)
}
\section{Graphical examples}{
 
\if{html}{
\figure{logit_correction_grid.png}{options: width="40\%" 
alt="Figure: logit_correction_grid.png"}
\cr
\figure{logit_correction_travel.png}{options: width="40\%" 
alt="Figure: logit_correction_travel.png"}
\cr
\figure{logit_correction_poly.png}{options: width="40\%" 
alt="Figure: logit_correction_poly.png"}
}
}

\examples{
data(zi)
data(catch)
data(choice)
data(distance)
data(si)
data(startloc)

optimOpt <- c(1000,1.00000000000000e-08,1,0)

methodname <- 'BFGS'

polyn <- 3
kk <- 4

si2 <- sample(1:5,dim(si)[1],replace=TRUE)
zi2 <- sample(1:10,dim(zi)[1],replace=TRUE)

otherdat <- list(griddat=list(si=as.matrix(si),si2=as.matrix(si2)),
    intdat=list(zi=as.matrix(zi),zi2=as.matrix(zi2)),
    startloc=as.matrix(startloc),polyn=polyn,
    distance=as.matrix(distance))

initparams <- c(3, 0.5, 0.4, 0.3, 0.2, 0.55, 0.45, 0.35, 0.25,
    rep(0, (((polyn+1)*2) + 2)*kk), -0.3,-0.4, 3)

func <- logit_correction

results <- discretefish_subroutine(catch,choice,distance,otherdat,
    initparams,optimOpt,func,methodname)

}
